import 'package:flutter/material.dart';

class ProgressPage extends StatelessWidget {
  const ProgressPage({super.key}); // 添加 const 支持

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('进度条演示')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text("这里是进度条页面"),
            const SizedBox(height: 20),
            _buildLinearProgressIndicator(),
            const SizedBox(height: 20),
            _buildCircularProgressIndicator(),
            const SizedBox(height: 20),
            _buildEllipticalProgressIndicator(),
          ],
        ),
      ),
    );
  }

  Widget _buildLinearProgressIndicator() {
    return const SizedBox(
      height: 4,
      child: LinearProgressIndicator(
        backgroundColor: Colors.grey,
        valueColor: AlwaysStoppedAnimation(Colors.blue),
      ),
    );
  }

  Widget _buildCircularProgressIndicator() {
    return const SizedBox(
      height: 100,
      width: 100,
      child: CircularProgressIndicator(
        backgroundColor: Colors.grey,
        valueColor: AlwaysStoppedAnimation(Colors.blue),
      ),
    );
  }

  //椭圆进度条
  Widget _buildEllipticalProgressIndicator() {
    return const SizedBox(
      height: 100,
      width: 300,
      child: CircularProgressIndicator(
        backgroundColor: Colors.grey,
        valueColor: AlwaysStoppedAnimation(Colors.blue),
      ),
    );
  }
}
